
import allure
from common.send_request import request_run_main


def allure_report(url,data,header,result):
    with allure.step("获取响应数据"):
        response = request_run_main( url=url, data=data, header=header)
        allure.attach('请求url={}\n 请求头header={}\n 请求数据data={}'.format(url, header,data), '请求参数',attachment_type=allure.attachment_type.TEXT)
        allure.attach('{}'.format(response.text), '响应数据', attachment_type=allure.attachment_type.TEXT)

        # 断言是否成功
    with allure.step("断言结果"):
        allure.attach('接口响应数据success={}且 data数据包含{}:{}'.format(result["success"],list(result.keys())[1],list(result.values())[1]), '断言结果',
                      attachment_type=allure.attachment_type.TEXT)
      #返回响应数据
    return response
